<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2024/9/2
  Time: 下午1:40
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>系统用户</title>
    <script src="js/jquery-1.8.0.min.js"></script>
    <link href="css/layui.css" rel="stylesheet">
    <script src="layui.js"></script>
</head>
<body>
    <%--    <h3>系统用户</h3>--%>
    <table id="aaa" lay-filter="test">
        <%--        <tr>--%>
        <%--            <th>编号</th>--%>
        <%--            <th>姓名</th>--%>
        <%--            <th>银行卡号</th>--%>
        <%--            <th>手机号码</th>--%>
        <%--            <th>余额</th>--%>
        <%--            <th>操作</th>--%>
        <%--        </tr>--%>

    </table>
    <script type="text/html" id="yui">
        <a className="layui-btn layui-btn-primary layui-btn-xs" lay-event="tansfer">转账</a>
    </script>
<script>
    layui.use(['table', 'form', 'layer'], function () {
        var table = layui.table;
        // 已知数据渲染
        table.render({
            elem: '#aaa',
            url: "cx",
            page: true,// 是否显示分页
            cols: [[ //标题栏
                {field: 'id', title: '编号', width: 80,fixed:'left', sort: true},
                {field: 'name', title: '姓名', width: 120},
                {field: 'bcm', title: '银行卡号', sort: true},
                {field: 'mph', title: '手机号码'},
                {field: 'balance', title: '余额', width: 100, sort: true},
                {field: '', title: '操作', width: 100, sort: true, toolbar: '#yui'}
            ]],
            parseData: function (res) {
                return {
                    "code": 0,
                    "msg": "请求成功",
                    "count": res.length, //解析数据长度
                    "data": res //解析数据列表
                }
            },
            //skin: 'line', // 表格风格
            //even: true,
            limits: [5, 10, 15],
            limit: 3 // 每页默认显示的数量
        });
        table.on("tool(test)", function (obj) {
            console.log(obj)
            console.log(obj.event)
            console.log(obj.data.id)
            if (obj.event == "tansfer") {
                location.href = 'html1.jsp?id=' + obj.data.id
            }
        })
    });
    <%--$(function () {--%>
    <%--    $.getJSON("<%=request.getContextPath()%>/cx", $("#aaa").serialize(), shoeew)--%>
    <%--})--%>
    <%--function shoeew(da) {--%>
    <%--    $(da).each(function (index, v) {--%>
    <%--        $("table").append("<tr>" +--%>
    <%--            "<th name='mid'>" + v.id + "</th>" +--%>
    <%--            "<th>" + v.name + "</th>" +--%>
    <%--            "<th>" + v.bcm + "</th>" +--%>
    <%--            "<th>" + v.mph + "</th>" +--%>
    <%--            "<th>" + v.balance + "</th>" +--%>
    <%--            "<th>" + "<a href='html1.jsp?id="+v.id+"'>转账</a></th>" +--%>
    <%--            "</tr>")--%>
    <%--    })--%>
    <%--}--%>
</script>
</body>
</html>
